<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

<script>

    var list = []
    for (var i = 0; i < 10; i++) {
        list[list.length] = Math.round(Math.random() * 100)
    }
    console.log(list);

    for (var j = 0; j < list.length - 1; j++) {
        if (list[j] > list[j + 1]) {
            var temp = list[j]
            list[j] = list[j + 1]
            list[j + 1] = temp
        }

    }
    console.log(list);


    for (var k = 0; k < list.length - 1; k++) {
        for (var j = 0; j < list.length - 1; j++) {
            if (list[j] < list[j + 1]) {
                var temp = list[j]
                list[j] = list[j + 1]
                list[j + 1] = temp
            }

        }
        console.log(list);
    }
</script>

</html>